package cn.edu.sjtu.software.sjtucontacts.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import cn.edu.sjtu.software.sjtucontacts.R;
import cn.edu.sjtu.software.sjtucontacts.util.GroupIDGenerator;

public class Group implements Serializable{
	
	private int id;
	private String name;
	private int number;
	private String portraitUrl;
	private List<Integer> contactList;
	
	public Group(){
		super();
		contactList = new ArrayList<Integer>();
		id = GroupIDGenerator.nextId();
		name = "";
		number = 0;
		portraitUrl = "";
	}
	
	public Group(int id, String name, int number, String portraitUrl, List<Integer> contactList){
		super();
		this.id = id;
		this.name = name;
		this.number = number;
		this.portraitUrl = portraitUrl;
		this.contactList = contactList;
	}
	
	public int getId(){
		return id;
	}
	
	public void setId(int id){
		this.id = id;
	}
	
	public String getName(){
		return name;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public int getNumber(){
		return number;
	}
	
	public void setNumber(int number){
		this.number = number;
	}
	
	public String getPortraitUrl() {
		return portraitUrl;
	}

	public void setPortraitUrl(String portraitUrl) {
		this.portraitUrl = portraitUrl;
	}
	
	public List<Integer> getContactList() {
		return contactList;
	}
	
	public void setContactList(List<Integer> contactList) {
		this.contactList = contactList;
	}
	
	public void addContact(int id) {
		contactList.add(new Integer(id));
		number++;
	}
	
	public void removeContact(int id) {
		System.out.println("remove custom id: "+ id);
		contactList.remove(new Integer(id));
		number--;
	}
}